package com.hjh.netty.elect.demo4;

import com.hjh.netty.elect.util.NumberDataConvertUtils;
import org.springframework.stereotype.Service;

/**
 * 基本谐波及电能质量数据 (子类=0x03，版本=0)
 * @author pyz
 *
 */
@Service("analysisBaseAndPowerQualityUpLoadDataService")
public class AnalysisBaseAndPowerQualityUpLoadDataService implements AnalysisUpLoadDataService{
	
	@Override
	public SubType3TypeVer0 analysisUpLoadData(String upLoadData) {
		int index = 0;
		SubType3TypeVer0 result = new SubType3TypeVer0();
		//A 相电流 THD  格式：float，单位：
		String I1THD = upLoadData.substring(index, index + 8);
		result.setI1THD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I1THD));
		index += 8;
		//B 相电流 THD  格式：float，单位：
		String I2THD = upLoadData.substring(index, index + 8);
		result.setI2THD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I2THD));
		index += 8;
		//C 相电流 THD  格式：float，单位：
		String I3THD = upLoadData.substring(index, index + 8);
		result.setI3THD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I3THD));
		index += 8;
		//A 相电流 TOHD  格式：float，单位：
		String I1TOHD = upLoadData.substring(index, index + 8);
		result.setI1TOHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I1TOHD));
		index += 8;
		//B 相电流 TOHD  格式：float，单位：
		String I2TOHD = upLoadData.substring(index, index + 8);
		result.setI2TOHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I2TOHD));
		index += 8;
		//C 相电流 TOHD  格式：float，单位：
		String I3TOHD = upLoadData.substring(index, index + 8);
		result.setI3TOHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I3TOHD));
		index += 8;
		//A 相电流 TEHD  格式：float，单位：
		String I1TEHD = upLoadData.substring(index, index + 8);
		result.setI1TEHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I1TEHD));
		index += 8;
		//B 相电流 TEHD  格式：float，单位：
		String I2TEHD = upLoadData.substring(index, index + 8);
		result.setI2TEHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I2TEHD));
		index += 8;
		//C 相电流 TEHD  格式：float，单位：
		String I3TEHD = upLoadData.substring(index, index + 8);
		result.setI3TEHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(I3TEHD));
		index += 8;
		//A 相电压 THD  格式：float，单位：
		String U1THD = upLoadData.substring(index, index + 8);
		result.setU1THD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U1THD));
		index += 8;
		//B 相电压 THD  格式：float，单位：
		String U2THD = upLoadData.substring(index, index + 8);
		result.setU2THD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U2THD));
		index += 8;
		//C 相电压 THD  格式：float，单位：
		String U3THD = upLoadData.substring(index, index + 8);
		result.setU3THD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U3THD));
		index += 8;
		//A 相电压 TOHD  格式：float，单位：
		String U1TOHD = upLoadData.substring(index, index + 8);
		result.setU1TOHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U1TOHD));
		index += 8;
		//B 相电压 TOHD  格式：float，单位：
		String U2TOHD = upLoadData.substring(index, index + 8);
		result.setU2TOHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U2TOHD));
		index += 8;
		//C 相电压 TOHD  格式：float，单位：
		String U3TOHD = upLoadData.substring(index, index + 8);
		result.setU3TOHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U3TOHD));
		index += 8;
		//A 相电压 TEHD  格式：float，单位：
		String U1TEHD = upLoadData.substring(index, index + 8);
		result.setU1TEHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U1TEHD));
		index += 8;
		//B 相电压 TEHD  格式：float，单位：
		String U2TEHD = upLoadData.substring(index, index + 8);
		result.setU2TEHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U2TEHD));
		index += 8;
		//C 相电压 TEHD  格式：float，单位：
		String U3TEHD = upLoadData.substring(index, index + 8);
		result.setU3TEHD(NumberDataConvertUtils.hexFloatString2decimalFloatString(U3TEHD));
		index += 8;
		//A 相电流 K 因子  格式：float，单位：
		String KFactor1 = upLoadData.substring(index, index + 8);
		result.setKFactor1(NumberDataConvertUtils.hexFloatString2decimalFloatString(KFactor1));
		index += 8;
		//B 相电流 K 因子  格式：float，单位：
		String KFactor2 = upLoadData.substring(index, index + 8);
		result.setKFactor2(NumberDataConvertUtils.hexFloatString2decimalFloatString(KFactor2));
		index += 8;
		//C 相电流 K 因子  格式：float，单位：
		String KFactor3 = upLoadData.substring(index, index + 8);
		result.setKFactor3(NumberDataConvertUtils.hexFloatString2decimalFloatString(KFactor3));
		index += 8;
		//A 相电流波峰因子  格式：float，单位：
		String CrestFactor1 = upLoadData.substring(index, index + 8);
		result.setCrestFactor1(NumberDataConvertUtils.hexFloatString2decimalFloatString(CrestFactor1));
		index += 8;
		//B 相电流波峰因子  格式：float，单位：
		String CrestFactor2 = upLoadData.substring(index, index + 8);
		result.setCrestFactor2(NumberDataConvertUtils.hexFloatString2decimalFloatString(CrestFactor2));
		index += 8;
		//C 相电流波峰因子  格式：float，单位：
		String CrestFactor3 = upLoadData.substring(index, index + 8);
		result.setCrestFactor3(NumberDataConvertUtils.hexFloatString2decimalFloatString(CrestFactor3));
		index += 8;
		//电压不平衡度  格式：float，单位：
		String UUnb = upLoadData.substring(index, index + 8);
		result.setUUnb(NumberDataConvertUtils.hexFloatString2decimalFloatString(UUnb));
		index += 8;
		//电流不平衡度  格式：float，单位：
		String IUnb = upLoadData.substring(index, index + 8);
		result.setIUnb(NumberDataConvertUtils.hexFloatString2decimalFloatString(IUnb));
		index += 8;
		
		return result;
	}

}
